package com.hsp_java.Homework;

import java.sql.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@SuppressWarnings({"all"})
public class Homework02 {
    public static void main(String[] args) {

        List list = new ArrayList();
        for (int i = 0; i < 10; i++) {
            list.add(new Car("xxx", i *10 + 10000));
        }

        list.add(new Car("Bench", 99999999));
        for (Object o : list) {
            System.out.println(o);
        }

        System.out.println("==========after remove======");
        list.remove(10);

        System.out.println(list);
        //for (Object o : list) {
        //    System.out.println(o);
        //}

        System.out.println(list.contains(new Car("xxx", 10000)));

        list.addAll(1, (Collection) new Car("2dfsd", 324));
        System.out.println(list);

    }
}
class Car {
    private String name;
    private double price;

    public Car(String name, double price) {
        this.name = name;
        this.price = price;
    }

    @Override
    public String toString() {
        return "Car{" +
                "name='" + name + '\'' +
                ", price=" + price +
                '}';
    }
}
